#include <iostream>
using namespace std;
int poptest(int tval){
	int rval;
	/*
	   push tval
	   movl %esp,%edx
	   popl %esp
	   movl %esp rval
	   movl %edx,%esp
	   */
	asm("push %1; movl %%esp,%%edx; popl %%esp; movl %%esp,%0; movl %%edx,%%esp"
			:"=r" (rval)
			:"r" (tval)
			:"%edx"
	   );
	return rval;
}
int main() {
	int x = 1;
	int y = poptest(x);
	cout << x << ',' << y << endl;
	if (x == y) cout << "same as { movl 0(%esp),%esp }" << endl;
	return 0;
}
